/***************************************************************************
 创建者: 华磊
 开始时间: 2020.8.14
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2020.5.8 类的具体实现代码编写

 ***************************************************************************/
#include "ethercaterror.h"
#include <stdio.h>

#include "ethercatVendorId.h"

EthercatError::EthercatError()
{

}

//台达的 文档是16bit+16bit的错误码，不知道哪个才是603f的
//英威腾 文档是16bit+16bit的错误码，不知道哪个才是603f的
//sx 报警 只取后16bit , 即  code=0xFF0C&0x00FF = 0x0c =12
QString EthercatError::geterror(int vendor, int error_code  , int productCode)
{
    switch( vendor )
    {
    case D_VENDOR_ID_YiLaiSi:
        return yiLaiSi_error(error_code );
    case D_VENDOR_ID_HeChuang:
        return heChuang_error(error_code );
    case D_VENDOR_ID_TCR:
        return tcr_error(error_code );
    case D_VENDOR_ID_Delta:
        return delta_error(error_code);
    case D_VENDOR_ID_Sanyo:
        return sanyo_error(error_code);
    case D_VENDOR_ID_LS:
        return ls_error(error_code);
    case D_VENDOR_ID_Panasonic:
        return panasonic_error(error_code);
    case D_VENDOR_ID_Invt:
        return invt_error(error_code);
    case D_VENDOR_ID_Servotronix:
        return cdhd_error(error_code);
    case D_VENDOR_ID_QingNengDeChuang:
        return dynatron_error(error_code);
    case D_VENDOR_ID_Inovance:
        return inovance_error(error_code);
    case D_VENDOR_ID_BURKMORE_STEP_MOTOR:
        return burkmore_step_motor_error(error_code);
    case E_VENDOR_ID_KINCO:
        return kinco_motor_error(error_code);
    case E_VENDOR_ID_MOTEC:
        return motec_motor_error(error_code);
    case E_VENDOR_ID_ROBOTIQ:
        return robotiq_motor_error(error_code);
    case E_VENDOR_ID_ROBOTIQ2MOTOR:
        return robotiq_motor_error(error_code);
    case E_VENDOR_ID_XingSong2MOTOR:
        return xinsong2motor_error(error_code);
    case E_VENDOR_ID_CURTIS2MOTOR:
        return curtius2motor_error(error_code);
    case E_VENDOR_ID_AMC:
        return amc_motor_error(error_code);
    case D_VENDOR_ID_TECHSERVO:
        return taike_error(error_code);

    default:
        return QString("品牌vendor=%1伺服异常保护: %2 !").arg(vendor).arg( error_code );
    }
}

int EthercatError::isRobotMotorBatteryOk(int vendor, int error_code, uint vendor_errorCode, int productCode)
{
    switch( vendor )
    {
    case D_VENDOR_ID_LeiSai_IO:
    {
        //todo
        return 1;

    }
    case D_VENDOR_ID_KAIFU:
    {
        //todo
        return 1;

    }
    case D_VENDOR_ID_YiLaiSi:
    {
        if(0x7305==error_code && 0x547305==vendor_errorCode)//？复位多圈错误。
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_HeChuang:
    {
        return 1;
        if(0x7305==error_code && 12==vendor_errorCode)//P20.06=7,然后上电，复位多圈错误。详细错误码0x213f
        {//vendor_errorCode 读取的0x213f，与面板显示一致 . 报错代码原因不唯一。中途编码器断线，也会时12号报警。
            return 0;
        }
        else
        {
            return 1;
        }
    }
        case D_VENDOR_ID_TCR:
        {
            if(0x001A==error_code)
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }
    case D_VENDOR_ID_Delta:
    {
        if(7305==error_code)//不确定　？？？
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_Sanyo:
    {
        if(0xA1==error_code)//不确定　？？？
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_LS:
    {
        if(0x32==error_code)//不确定　？？？
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_Panasonic:
    {
        if(47==error_code)//不确定　？？？
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_Invt:
    {
        if(0x73000209==error_code)
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_Servotronix:
    {
        if(0x7389==error_code)//不确定　？？？
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_QingNengDeChuang:
    {
        if(0xFF2A==error_code)//确定
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_Inovance:
    {
        if(0x7305==error_code && 0x310731==vendor_errorCode)//确定
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    case D_VENDOR_ID_BURKMORE_STEP_MOTOR:
    {
        if(0x7382==error_code)//确定
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }


    default:
        printf("不识别的　ethercat D_VENDOR_ID");
        return -100;

    }
    return -100;
}

QString EthercatError::yiLaiSi_error(int error_code)
{
    switch( error_code )
    {
    case 0x2311:  return "功率模块报警 !";
    case 0x2310:  return "过流!";
    case 0x3120:  return "欠压!";
    case 0x3110:  return "过压!";
    case 0x6320:  return "AL005电流采样异常｜AL010芯片初始化错误|AL035不同DI分配了同一功能|AL045参数设定超范围!!";
    case 0x8400:  return "超速!";
    case 0x8611:  return "位置超差!";
    case 0xff00:  return "AL009用户力矩命令过载｜AL120凸轮表数据越界｜AL185同步丢失｜AL015调节器保护!";
    case 0x4210:  return "AL014电机热过载|AL022 ＩＧＢＴ温度过高!!";
    case 0x2312:  return "采样电流饱和!";
    case 0x3230:  return "AL017电机过载|AL023驱动器过载!";
    case 0x3210:  return "制动异常!";
    case 0x3130:  return "缺相!";
    case 0x5441:  return "紧急停止!";
    case 0x5442:  return "正向极限动作!";
    case 0x5443:  return "反向极限动作!";
    case 0x5530:  return "EEPROM失败!";
    case 0x7305:  return "AL050编码器初始化错误｜AL052编码器通讯错误｜AL054编码器电池报警｜AL055编码器多圈溢出｜AL056编码器内部错误!";
    case 0x8610:  return "全闭环内外编码器偏差太大!";
    case 0x7510:  return "串行通信故障!";
    case 0x7520:  return "串行通信超时!";
    case 0x5444:  return "软件正向极限!";
    case 0x5445:  return "软件负向极限!";
    case 0x8100:  return "AL186 servon时收到ＮＭＴ RESET命令｜AL251 ETHERCAT通讯中断!";
    case 0x8120:  return "CANBUS硬件异常警告!";
    case 0x8130:  return "监控心跳或节点保护错误!";
    case 0x8110:  return "AL210　SDO接收溢出｜AL211　pdo接收溢出| AL252 ETHERCAT通讯操作模式ＰＤＯ连续丢失!";
    case 0x8200:  return "PDO错误!";
    case 0x6310:  return "ethercat初始化失败!";

    default:
        return QString("其它错误,伊莱斯伺服0x603f错误码:%1，详细错误码查看0x3025对象").arg( error_code );
    }

}

QString EthercatError::heChuang_error(int error_code)
{
    switch( error_code )
    {
    case 0x6320:  return "系统参数异常｜产品型号选择故障 !";
    case 0x7305:  return "err007编码器初始化失败|err012增量光电编码器Z断线或者绝对值编码器圈数异常|err015编码器电池电压过低异常|al097编码器电池欠压 !";
    case 0x2310:  return "过流故障 !";
    case 0x8400:  return "速度偏差过大|飞车故障|过速 !";
    case 0x3220:  return "控制电欠压|欠电压|欠电压警告 !";
    case 0xff00:  return "电角度辨识失败|原点回归错误 !";
    case 0x8611:  return "位置偏差过大故障|全闭环位置偏差过大 !";
    case 0x3130:  return " 主回路输入缺相|驱动器输出缺相!";
    case 0x3230:  return "驱动器过载 !";
    case 0x4210:  return "散热器过热!";
    case 0x5100:  return "主电源断电 !";
    case 0x7500:  return "同步失败|EtherCAT通讯中断 !";
    case 0x8500:  return "位置指令过速 !";

    default:
        return QString("其它错误,禾川伺服0x603f错误码:%1.详细错误码查看0x213f对象").arg( error_code );
    }


}

QString EthercatError::getwarn( int vendor, int error_code ,int productCode)
{
    QString msg;
    switch( vendor )
    {
    case D_VENDOR_ID_TCR:
        msg= tcr_warn(error_code  );
        break;
    default:
        switch( error_code )
        {
        case D_WARM_RST_PFAIL:
            msg="主电源缺相！";
            break;
        case D_WARM_LOW_BATT:
            msg= "电池电量不足!";
            break;
        case D_WARM_OV_TCMD:
            msg=  "扭矩指令过大!";
            break;
        case D_WARM_OV_VCMD:
            msg= "速度指令过大!";
            break;
        case D_WARM_OV_LOAD:
            msg="过载警告!";
            break;
        case D_WARM_SETUP:
            msg="选定容量!";
            break;
        case D_WARM_UD_VTG:
            msg="低电压警告!";
            break;
        case D_WARM_EMG:
            msg="EMG警告!";
            break;
        default:
            msg="伺服警告保护!";
            break;
        }
        break;
    }
    return msg;
}

QString EthercatError::sanyo_error(int error_code)
{
#if 1
    //0x2102
    int err=error_code&0x00FF;
    switch( err )
    {
    case 0x10:  return "端口 0 连续接收无效数据帧 !";
    case 0x11:  return "端口 0 丢失链接 !";
    case 0x12:  return "端口 0 连续发生 Rx 错误 !";
    case 0x13:  return "端口 1 连续发生 Rx 错误 !";
    case 0x14:  return "端口 0 连续发生 TX 错误 !";
    case 0x15:  return "端口 1 连续发生 TX 错误 !";
    case 0x18:  return "端口 0 丢失链接 !";
    case 0x19:  return "端口 1 丢失链接 !";
    case 0x1A:  return "通信超时 !";
    case 0x21:  return "主电路电源设备异常 !";
    case 0x22:  return "电流检出异常0 !";
    case 0x23:  return "电流检出异常1 !";
    case 0x24:  return "电流检出异常2 !";
    case 0x25:  return "安全转矩(推力)切断异常 1 !";
    case 0x26:  return "安全转矩(推力)切断异常 2 !";
    case 0x41:  return "过载1 !";
    case 0x42:  return "过载2 !";
    case 0x43:  return "再生过载 !";
    case 0x44:  return "磁极位置检出异常 !";
    case 0x45:  return "连续转速过大 !";
    case 0x51:  return "驱动器温度异常 !";
    case 0x52:  return "防浪涌电阻过热 !";
    case 0x53:  return "动态制动器电阻过热 !";
    case 0x54:  return "内部再生电阻过热 !";
    case 0x55:  return "外部过热 !";
    case 0x56:  return "主电路电源设备过热 !";
    case 0x61:  return "过电压 !";
    case 0x62:  return "主电路电源不足 !";
    case 0x63:  return "主电源欠相 !";
    case 0x71:  return "控制电源电压过低 !";
    case 0x72:  return "控制电源电压过低 !";
    case 0x73:  return "控制电源电压过低 !";
    case 0x81:  return "编码器连接器 1 断线 !";
    case 0x83:  return "编码器连接器 2 断线 !";
    case 0x84:  return "串行编码器通信异常 !";
    case 0x85:  return "编码器初始处理异常 !";
    case 0x86:  return "CS 异常 !";
    case 0x87:  return "CS 断线 !";
    case 0xA0:  return "串行编码器内部异常0, 多圈计数器溢出 !";
    case 0xA1:  return "串行编码器内部异常1,电池电压过低 !";
    case 0xA2:  return "串行编码器内部异常2,加速度异常 !";
    case 0xA3:  return "串行编码器内部异常3,超速异常 !";
    case 0xA4:  return "串行编码器内部异常4 ,编码器内部 EEPROM 的读取操作异常!";
    case 0xA5:  return "串行编码器内部异常5,检出单圈系数不良 !";
    case 0xA6:  return "串行编码器内部异常6,检出多圈系数不良 !";
    case 0xA9:  return "串行编码器内部异常9,伺服电机内置编码器过热 !";
    case 0xAA:  return "串行编码器内部异常10,增量异常(位置数据异常) !";
    case 0xAC:  return "串行编码器内部异常12,多圈生成异常 !";
    case 0xAD:  return "串行编码器内部异常13,未设置编码器内置 EEPROM 数据 !";
    case 0xAE:  return "串行编码器内部异常14,旋转变压器输出异常 !";
    case 0xAF:  return "串行编码器内部异常15,旋转变压器断线 !";
    case 0xC1:  return "超速 !";
    case 0xC2:  return "速度控制异常 !";
    case 0xC3:  return "速度反馈异常 !";
    case 0xD1:  return "模型跟随抑振控制异常 !";
    case 0xD2:  return "位置偏差过大 !";
    case 0xD3:  return "位置指令异常1 !";
    case 0xDE:  return "位置指令异常2 !";
    case 0xDF:  return "退出测试模式 !";
    case 0xE1:  return "EEPROM 异常 !";
    case 0xE2:  return "EEPROM 校验和异常 !";
    case 0xE3:  return "存储器异常 1 !";
    case 0xE4:  return "存储器异常 2 !";
    case 0xE5:  return "系统参数超出设置范围 !";
    case 0xE6:  return "系统参数与驱动器不匹配 !";
    case 0xE7:  return "电机参数异常 !";
    case 0xE8:  return "CPU 周边电路异常 !";
    case 0xE9:  return "系统编码错误 !";
    case 0xEA:  return "电机编码设置异常 !";
    case 0xEB:  return "传感器编码设置异常 !";
    case 0xEE:  return "无法自动配置电机参数 !";
    case 0xEF:  return "自动配置电机参数结果异常 !";
    case 0xF1:  return "任务处理异常,周期同步异常 !";
    case 0xF2:  return "初始化超时 !";
    case 0xFF:  return "闪存超时 !";
    default:
        return "其他错误 !";
    }
#else
    //603f
    switch( error_code )
    {
    case 0x7510:
        return "通信错误";

    case 0x7520:
        return "端口 0 丢失链接!";

    case 0x5400:
        return "主电路电源设备异常 (电源元件异常) !";

    case 0x5210:
        return "电流检出异常 !";

    case 0x8312:
        return "安全转矩(推力)切断异常 !";

    case 0x8311:
        return "过载1 !";

    case 0x2220:
        return "过载2 !";

    case 0x3212:
        return "再生过载 !";

        //    case 0x7300:
        //        return "磁极位置检出异常 !";

        //    case 0x8400:
        //        return "连续转速过大 !";

    case 0x4110:
        return "驱动器温度异常 !";

    case 0x4210:
        return "电阻过热/主电路电源设备过热 !";

    case 0x4310:
        return "外部过热 !";

    case 0x3211:
        return "过电压 !";

    case 0x3220:
        return "主电路电源不足 !";

    case 0x3130:
        return "主电源欠相 !";

    case 0x5114:
        return "控制电源电压过低 !";

    case 0x5115:
        return "控制电源电压过低 1 !";

    case 0x5113:
        return "控制电源电压过低 2 !";

    case 0x7305:
        return "编码器连接器 1 断线 !";

    case 0x7306:
        return "编码器连接器 2 断线 !";

    case 0x7300:
        return "串行编码器异常 !";

    case 0x7310:
        return "串行编码器内部异常2 !";

    case 0x7320:
        return "串行编码器内部异常 10 !";

    case 0x7303:
        return "串行编码器内部异常 14 !";

    case 0x7304:
        return "串行编码器内部异常 15 !";

    case 0x8400:
        return "超速/速度控制异常 !";

    case 0x7122:
        return "速度反馈异常 !";

    case 0x8500:
        return "位置指令异常/模型跟随抑振控制异常 !";

    case 0x8611:
        return "位置偏差过大 !";

    case 0xFF01:
        return "参数变更完毕 !";

    case 0xFF00:
        return "退出测试模式 !";

    case 0x5530:
        return "EEPROM 异常 !";

    case 0x6310:
        return "EEPROM 校验和异常 !";

    case 0x5510:
        return "存储器异常 !";

    case 0x5220:
        return "系统编码错误 /CPU 周边电路异常 !";

    case 0x6320:
        return "系统参数异常/电机参数异常 !";

    case 0x8700:
        return "任务处理异常 !";

    case 0x6010:
        return "初始化超时 !";

    default:
        return "其他错误 !";
    }
#endif
}
//sx 报警 只取后16bit , 即  code=0xFF0C&0x00FF = 0x0c =12
QString EthercatError::panasonic_error(int error_code)
{
    //sx 报警 只取后16bit , 即  code=0xFF0C&0x00FF = 0x0c =12
    int err= 0x00FF & error_code;
    switch( err )
    {
    case 80:
        return "PDO 看门狗异常保护/ 同期信号异常保护 !";

    case 81:
        return "设定异常保护: DC/Mailbox/SM/PDO看门狗/ 同期周期 !";

    case 85:
        return "PDO分配异常/ SII异常保护 !";

    case 88:
        return "(主电源电压不足/不正常动作/控制模式)异常保护 !";

    case 11:
        return "控制电源电压不足 !";

    case 12:
        return "过压保护 !";

    case 13:
        return "主电源电压不足 !";

    case 14:
        return "过电流保护/IPM异常 !";

    case 15:
        return "过热保护 !";

    case 16:
        return "过载保护 !";

    case 18:
        return "回升过负载 !";

    case 21:
        return "编码器通信异常 !";

    case 23:
        return "编码器通信数据异常 !";

    case 24:
        return "位置偏差过大/速度偏差过大 !";

    case 25:
        return "混合偏差过大 !";

    case 26:
        return "过速度保护 !";

    case 27:
        return "指令异常保护／位置信息初始化异常保护 !";

    case 28:
        return "脉冲再生限制保护 !";

    case 29:
        return "计数器溢出保护 !";

    case 30:
        return "安全输入保护 !";
    case 33:
        return "输入输出分配异常保护 !";
    case 34:
        return "电机可移动范围设定异常保护 !";
    case 36:
        return "EEPROM参数异常保护 !";
    case 37:
        return "EEPROM确认代码异常保护 !";
    case 38:
        return "驱动禁止输入保护 !";
    case 40:
        return "绝对式系统关闭保护 !";
    case 41:
        return "绝对式计数器溢出保护 !";
    case 42:
        return "绝对式过速保护 !";
    case 43:
        return "增量式编码器初始化异常保护 !";
    case 44:
        return "回转计数1异常保护 !";
    case 45:
        return "回转计数异常保护 !";
    case 47:
        return "绝对式状态异常保护 !";
    case 48:
        return "增量式状态Z相异常保护 !";
    case 49:
        return "增量式状态CS相异常保护 !";
    case 50:
        return "外部光栅尺数据异常／未接地 !";
    case 51:
        return "外部光栅尺ST异常 !";
    case 55:
        return "A.B.Z相接线异常保护 !";
    case 84:
        return "同期建立初始化异常保护 !";
    case 87:
        return "强制报警输入保护 !";
    case 91:
        return "命令异常保护 !";
    case 92:
        return "编码器数据复原异常/外部光栅尺数据复原异常 !";
    case 93:
        return "参数设定异常/外部光栅尺接地异常 !";
    case 94:
        return "原点复位异常２ !";
    case 95:
        return "电机自动识别异常保护 !";
    case 98:
        return "通信IC初始化异常保护 !";

    default:
        return QString("其他异常保护,错误码:%1").arg( error_code );
    }
}
//英威腾　文档是16bit+16bit的错误码，不知道哪个才是603f的
QString EthercatError::invt_error(int error_code)
{
    switch( error_code )
    {
    case 0xFF010101:
        return "IGBT 故障 !";

    case 0x73000200:
        return "编码器故障-编码器断线 !";

    case 0x73000201:
        return "编码器故障-编码器反馈误差过大 !";

    case 0x73000202:
        return "编码器故障-奇偶校验错误 !";

    case 0x73000203:
        return "编码器故障-CRC校验错误 !";

    case 0x73000204:
        return "编码器故障-帧错误 !";

    case 0x73000205:
        return "编码器故障-短帧错误 !";

    case 0x73000206:
        return "编码器故障-编码器报超时 !";

    case 0x73000207:
        return "编码器故障-FPGA报超时 !";

    case 0x73000208:
        return "编码器故障-编码器电池低压报警 !";

    case 0x73000209:
        return "编码器故障-编码器电池欠压故障 !";

    case 0x7300020A:
        return "编码器故障-编码器过热 !";

    case 0x7300020B:
        return "编码器故障-编码器EEPROM写入错误 !";

    case 0x73000300:
        return "电流传感器故障-U相电流传感器故障 !";

    case 0x73000301:
        return "电流传感器故障-V相电流传感器故障 !";

    case 0x73000302:
        return "电流传感器故障-W相电流传感器故障 !";

    case 0xFF010400:
        return "系统初始化故障 !";

    case 0xFF010501:
        return "设置故障-电机型号不存在 !";

    case 0xFF010502:
        return "设置故障-电机和驱动器型号不匹配 !";

    case 0xFF010503:
        return "设置故障-软限位设置故障 !";

    case 0xFF010504:
        return "设置故障-会原点模式设置故障 !";

    case 0xFF010505:
        return "设置故障-点位控制行程故障 !";

    case 0x7100700:
        return "再生放电过载 !";

    case 0x54410800:
        return "模拟输入过压-模拟量速度指令 !";

    case 0x54420801:
        return "模拟输入过压-模拟量转距指令 !";

    case 0x54430802:
        return "模拟输入过压-模拟量输入3 !";

    case 0x55300900:
        return "EEPROM-读写故障 !";

    case 0x55300901:
        return "EEPROM-数据校验故障 !";

    case 0x554400A00:
        return "硬件故障-FPGA故障 !";

    case 0x55440A01:
        return "硬件故障-通信卡故障 !";

    case 0x55440A02:
        return "硬件故障-对敌短路故障 !";

    case 0x55440A03:
        return "硬件故障-外部输入故障 !";

    case 0x44580A04:
        return "硬件故障-紧急停机故障 !";

    case 0x61000b01:
        return "软件故障-周期任务重入 !";

    case 0x61000b02:
        return "软件故障-非法操作 !";

    case 0xFF010C00:
        return "IO故障-开关量输入分配重复 !";

    case 0xFF010C01:
        return "IO故障-脉冲输入频率过高 !";

    case 0x31100D00:
        return "主回路过压故障 !";

        ///
    case 0x31200d01:
        return "主回路欠压故障 !";

    case 0x52000e00:
        return "控制电源欠压故障 !";

    case 0x23101200:
        return "电机过载故障 !";
    case 0x71801300:
        return "速度故障 !";

    case 0x84001400:
        return "速度超差 !";

    case 0x85001600:
        return "位置超差 !";

    case 0xff011601:
        return "混合控制偏差过大 !";

    case 0xff011602:
        return "位置增量溢出故障 !";

    default:
        return QString("其他异常保护,错误码:%1").arg( error_code );
    }
}
//台达的文档是16bit+16bit的错误码，不知道哪个才是603f的
QString EthercatError::delta_error(int error_code)
{
    switch(error_code)
    {
    case 	2310	:	return  "过电流 !" ;
    case 	3110	:	return  "过电压 !" ;
    case 	3120	:	return  "低电压 !" ;
    case 	7122	:	return  "电机匹配错误 !" ;
    case 	3210	:	return  "回生异常 !" ;
    case 	3230	:	return  "过负荷 !" ;
    case 	8400	:	return  "过速度 !" ;
    case 	8600	:	return  "异常脉冲控制命令 !" ;
    case 	8611	:	return  "位置控制误差过大 !" ;
        //  case 	0000	:	return  "保留 !" ;
    case 	7305	:	return  "编码器异常 !" ;
    case 	6320	:	return  "校正异常 !" ;
    case 	5441	:	return  "紧急停止 !" ;
    case 	5443	:	return  "反向极限异常 !" ;
    case 	5442	:	return  "正向极限异常 !" ;
    case 	4210	:	return  "IGBT过热 !" ;
    case 	5330	:	return  "参数内存异常 !" ;
    case 	7306	:	return  "检出器输出异常 !" ;
    case 	7510	:	return  "串行通讯异常 !" ;
    case 	7520	:	return  "串行通讯逾时 !" ;
    case 	3130	:	return  "主回路电源异常 !" ;
    case 	3231	:	return  "预先过负载警告 !" ;
        //    case 	7305	:	return  "编码器初始磁场错误 !" ;
        //    case 	7305	:	return  "编码器内部错误 !" ;
        //    case 	7305	:	return  "编码器内部数据可靠度错误 !" ;
        //    case 	7305	:	return  "编码器内部重置错误 !" ;
    case 	7121	:	return  "电机碰撞错误 !" ;
    case 	3300	:	return  "电机U、V、W接线错误 !" ;
    case 	8610	:	return  "全闭环位置控制误差过大 !" ;
    case 	5500	:	return  "DSP 韧体升级 !" ;
    case 	6310	:	return  "数据初始错误 !" ;
    case 	5444	:	return  "软件正向极限 !" ;
    case 	5445	:	return  "软件负向极限 !" ;
    case 	8120	:	return  "EtherCAT 通讯中断(Servo Off) !" ;

        //    case 	8130 	:	return  "Node guarding 或 heartbeat 错误(Servo Off) !" ;
    case 	8130	:	return  "存取CANopen PDO对象时 发生错误 !" ;
        //    case 	8130	:	return  "存取CANopen PDO对象时sub-index发生错误 !" ;
        //   case 	8200	:	return  "存取CANopen PDO对象时数据长度发生错误 !" ;
        //    case 	8200	:	return  "存取CANopen PDO对象时数据范围发生错误 !" ;
        //    case 	8200	:	return  "CANopen PDO 对象是只读不可写入 !" ;
        //    case 	8200	:	return  "CANopen PDO 对象无法支持PDO !" ;
        //    case 	8200	:	return  "CANopen PDO 对象在 Servo On时 不允许写入 !" ;
        //    case 	8200	:	return  "由EEPROM读取CANopen PDO 对象时发生错误 !" ;
        //    case 	8200	:	return  "将CANopen PDO对象写入EEPROM时发生错误 !" ;
        //    case 	8200	:	return  "EEPROM的地址超过限制 !" ;
        //    case 	8200	:	return  "EEPROM数据内容错误 !" ;
        //    case 	8200	:	return  "密码错误 !" ;
        //    case 	6310	:	return  "CANopen 数据初始错误  !" ;
        //    case 	6200	:	return  "CANopen 同步失败(Servo Off) !" ;
        //    case 	6200	:	return  "CANopen 同步信号错误(Servo Off) !" ;
        //    case 	6200	:	return  "CANopen 同步信号逾时(Servo Off) !" ;
        //    case 	6200	:	return  "CANopen IP 命令失效(Servo Off) !" ;
    case 	6200	:	return  "同步信号周期错误(Servo Off) !" ;
        //    case 	9000	:	return  "STO功能被启动(Servo Off) !" ;
        //    case 	9000	:	return  "STO_A无信号(Servo Off) !" ;
        //    case 	9000	:	return  "STO_B无信号(Servo Off) !" ;
    case 	9000	:	return  "STO错误(Servo Off) !" ;

        /*SDO :错误信息 Abort Code
05040001 h 客户 / 伺服命令无效或不存在
06010002 h 尝试写入只读对象
06020000 h 对象不存在于对象字典内
06040041 h 无法将对象映像至 PDO
06040042 h 映像的物件数目及长度超过 PDO 长度
06060000 h 因为硬件错误导致存取失败(储存或还原错误)
06070010 h 数据型态不符;参数长度不符
06090011 h Sub-index 不存在
06090030 h 参数数值超出范围(写入)
08000000 h 一般错误
080000a1 h 从 EEPROM 读取对象时发生错误
080000a2 h 将对象写入 EEPROM 时发生错误
080000a3 h 存取 EEPROM 时的范围无效
080000a4 h 存取 EEPROM 时,EEPROM 的数据内容发生错误
080000a5 h 写入加密区时,输入的密码错误
08000020 h 无法传输数据或将数据储存至应用程序内
08000021 h
因为限制(以错误状态储存或还原)导致无法传输数据,或无法将数据储存至应用程
序内
08000022 h 对象使用中
*/
    default:
        return QString("其他异常保护,错误码:%1").arg( error_code );
    }
}
//ok
QString  EthercatError::ls_error(int error_code)
{
    switch( error_code )
    {
    case 0x10:
        return "IPM错误，过电流(H/W) !";

    case 0x11:
        return "IPM过热 ,请检查接线 !";

    case 0x14:
        return "过电流(S/W) !";

    case 0x15:
        return "电流漂移异常 !";

    case 0x16:
        return "过电流(H/W) !";

    case 0x21:
        return "连续超载 !";

    case 0x22:
        return "驱动器过热 !";

    case 0x23:
        return "再生超载 !";

    case 0x24:
        return "电路回路中断 !";

    case 0x30:
        return "串行编码器通信错误 !";

    case 0x31:
        return "编码器电缆断开 !";

    case 0x32:
        return "编码器数据错误 !";

    case 0x33:
        return "电机 ID 设置错误 !";

    case 0x40:
        return "低电压 !";

    case 0x41:
        return "过电压 !";

    case 0x42:
        return "主电源异常 !";

    case 0x43:
        return "控制电源异常 !";

    case 0x50:
        return "超速 !";

    case 0x51:
        return "位置误差过大 !";

    case 0x53:
        return "脉冲指令频率异常 !";

    case 0x63:
        return "参数异常 !";

    case 0x64:
        return "参数范围以上 !";

    case 0x65:
        return "EtherCAT 通信异常1 !";
    case 0x66:
        return "EtherCAT 通信异常2 !";
    case 0x67:
        return "EtherCAT 通信异常3 !";

    case 0x71:
        return "出厂值发生错误 !";

    case 0x72:
        return "输出接点设置异常 !";

    default:
        return QString("其他异常保护,错误码:%1").arg( error_code );
    }
}

//ok
QString EthercatError::tcr_warn(int error_code  )
{
    //~0x0(1)0FF故障码保留
    //-------------------------------------
    //;2.警告代码:
    switch( error_code )
    {
    //    case 0xE00:
    //        return "ER.警告最小值 !";

    case 0x001:
        return "ER.E01 电机过热警告 !";

    case 0x002:
        return "ER.E02 驱动器过热警告 !";

    case 0x003:
        return "ER.E03 电机过载警告 !";

    case 0x004:
        return "ER.E04 驱动器过载警告 !";

    case 0x005:
        return "ER.E05 位置偏差太大警告 !";

    case 0x006:
        return "ER.E06 制动过载警告 !";

    case 0x007:
        return "ER.E07 正向超程警告 !";

    case 0x008:
        return "ER.E08 反向超程警告 !";

    default:
        return QString("其他异常保护,警告码:%1").arg( error_code );
    }

}
QString EthercatError::tcr_error(int error_code  )
{
    //1.故障码:
    switch( error_code )
    {
    case 0x0001:
        return "ER.001  硬件(短路)保护 !";

    case 0x0002:
        return "ER.002 HOC !";

    case 0x0003:
        return "ER.003 AD模块初始校正故障 !";

    case 0x0104:
        return "ER.004  参数存储异常 !";

    case 0x0005:
        return "ER.005  系统参数异常 !";

    case 0x0006:
        return "ER.006 Ad采样模块故障 !";

    case 0x0007:
        return "ER.007  编码器异常1 断线 !";

    case 0x0008:
        return "ER.008  编码器异常2 AB干扰 !";

    case 0x0009:
        return "ER.009  编码器异常3 Z干扰 !";

    case 0x000A://0x110A
        return "ER.00A 母线欠压故障 !";

    case 0x000B:
        return "ER.00b 母线过压故障 !";

    case 0x000C://0x100C
        return "ER.00C 软件过流故障 !";

    case 0x000D://0x100D
        return "ER.00d 电机过载故障 !";

    case 0x000E://0x110E
        return "ER.00E 驱动器过载 !";

    case 0x000F://0x110F
        return "ER.00F 电机过热 !";

    case 0x010://0x1110
        return "ER.010  驱动器过热 !";

    case 0x011://0x1111
        return "ER.011  风扇异常 !";

    case 0x012://0x1012
        return "ER.012  过速 !";

    case 0x013://0x1113
        return "ER.013  位置偏差过大故障 !";

    case 0x014://0x1114
        return "ER.014  母线电压缺相故障 !";

    case 0x015://0x1015
        return "ER.015  电机相序错误 !";

    case 0x0016:
        return "ER.016  驱动器额定电流输入错误(或code不存在) !";

    case 0x017://0x1117
        return "ER.017  制动电阻过载故障 !";

    case 0x0018:
        return "ER.018  绝对值编码器过热 !";

    case 0x019://0x1019
        return "ER.019  绝对值编码器电池电压低于3.1V,电池电压偏低 !";

    case 0x001A:
        return "ER.01A 绝对值编码器电池电压低于2.5V,多圈位置信息已丢失 !";

    case 0x001B:
        return "ER.01b 驱动器和电机不匹配 !";

    case 0x01C://0x101C
        return "ER.01C 原点回归失败 !";

    case 0x01d:// 0x101D
        return "ER.01d 主电源掉电 !";

    case 0x01E://0x101e
        return "ER.01E 偏移角学习失败 !";

    case 0x001F:
        return "ER.01F !";

    case 0x0020:
        return "ER.020 ECAT 初始化LAN9252错误 !";

    case 0x021://0x1021
        return "ER.021 ECAT DSP与ESC通信中断 !";

    case 0x022://0x1022
        return "ER.022 ECAT 与主机通讯中断 !";

    case 0x023://0x1123
        return "ER.023 ECAT PDO通信参数在Servo读 !";

    case 0x024://0x1124
        return "ER.024 ECAT PDO通信没有要查找的索引和子索引 !";

    case 0x025://0x1125
        return "ER.025 ECAT PDO通信设置同步时间超范围 !";

    case 0x026://0x1126
        return "ER.026 ECAT PDO通信数据超范围 !";

    case 0x0027:
        return "ER.027 UVW对地短路故障 !";

    case 0x028://0x1028
        return "ER.028  惯量辨识失败 !";

    case 0x030://0x1030
        return "ER.030 402 位置正向极限 !";

    case 0x031://0x1031
        return "ER.031 402 位置负向极限 !";

    default:
        return QString("其他异常保护,错误码:%1").arg( error_code );
    }
}

// 高创
QString EthercatError::cdhd_error(int error_code)
{
    switch( error_code )
    {

    case 0x2214: return "Over-current  !";
    case 0x2310: return "Motor foldback  !";
    case 0x2311: return "Drive foldback !";
    case 0x2380: return "Current sensors offset out-of-range  !";
    case 0x2381: return "Motor phase disconnection  !";
    case 0x2382: return "Output over-current detected  !";
    case 0x3110: return "Over-voltage !";
    case 0x3120: return "Under-voltage  !";

    case 0x3180: return "Regen over-current  !";
    case 0x3181: return "STO (safe torque off) is not connected !";
    case 0x3182: return "Bus voltage measurement circuit failure !";
    case 0x3183: return "Bus AC supply line disconnect !";
    case 0x4080: return "Integrated power module over-temperature !";
    case 0x4081: return "Control board over-temperature !";
    case 0x4310: return "Drive over-temperature !";
    case 0x4410: return "Motor over-temperature  !";
    case 0x5111: return "Control +15V/-15V out-of-range !";
  //  case 0x5111: return "Control  out-of-range  !";
    case 0x5180: return "5V out of range  !";
    case 0x5530: return "Power board EEPROM fault  !";
    case 0x5581: return "Control digital board EEPROM fault  !";
    case 0x5582: return "CAN voltage supply fault !";
    case 0x5583: return "Self test failed  !";
    case 0x5585: return "Parameter memory checksum failure !";
    case 0x5586: return "Failure writing to flash memory !";
    case 0x6101: return "Internal error !";
    case 0x6102: return "Realtime overload fault _ !";
    case 0x6381: return "Drive not configured -1 !";
    case 0x6581: return "FPGA configuration failure !";
    case 0x7097: return "BiSS-C encoder indicates an internal fault  !";
    case 0x7098: return "HIPERFACE data error  !";
    case 0x7111: return "Index line break  !";
    case 0x7112: return "Open load on the power brake output !";
    case 0x7113: return "Short circuit on the power brake output  !";
    case 0x7114: return "Fieldbus – Target position exceeds velocity limit  !";
    case 0x7116: return "EtherCAT cable disconnected   !";
    case 0x7117: return "Fieldbus target command lost  !";
    case 0x711D: return "EtherCAT packets lost  !";
    case 0x711E: return "CAN/EtherCAT state not operational !";
    case 0x711F: return "Power brake fault  !";
    case 0x7180: return "Secondary encoder (feedback) index break  !";
    case 0x7181: return "Secondary encoder (feedback) A/B line break  !";
    case 0x7182: return "Pulse & direction input line break  !";
    case 0x7380: return "Feedback communication error !";

    case 0x7381: return "Nikon encoder (feedback) operation fault  !";
    case 0x7382: return "Tamagawa feedback initialization failed  !";
    case 0x7383: return "A/B Line break !";
    case 0x7384: return "Illegal Halls  !";
    case 0x7385: return "Tamagawa battery low voltage !/ Absolute encoder battery low-voltage  !";
    case 0x7386: return "PLL synchronization failed !";
    case 0x7388: return "Tamagawa abs operational fault  !";
    case 0x7389: return "Custom absolute encoder operational fault  !";
    case 0x738A: return "Differential Halls line break  !";
    case 0x738B: return "Encoder phase error  !";
    case 0x738C: return "AqB commutation fault  !";
    case 0x738D: return "SensAR encoder fault  !";
    case 0x7390: return "Sankyo absolute encoder fault  !";
    case 0x7781: return "Motor setup failed !";
    case 0x7782: return "Phase find failed  !";
    case 0x7783: return "Encoder simulation frequency too high  !";
    case 0x7784: return "EnDat sine (feedback) communication failed !";
    case 0x7785: return "A/B out-of-range  !";
    case 0x7786: return "Sine encoder quadrature  !";
    case 0x7787: return "Sine/cosine calibration invalid  !";
    case 0x7788: return "Encoder (feedback) 5V over-current  !";
    case 0x7789: return "Secondary encoder (feedback) 5V over-current !";
    case 0x778B: return "Resolver initialization failed  !";
    case 0x778C: return "Stall fault  !";
    case 0x778D: return "PFB Off checksum invalid !";
    case 0x778E: return "PFB Off data mismatch !";
    case 0x778F: return "No PFB Off data  !";
    case 0x7790: return "FPGA version mismatch !";
    case 0x7791: return "Emergency stop issued  !";
    case 0x7792: return "Endat2x feedback faults  !";
    case 0x7793: return "Fieldbus version mismatch !";
    case 0x7794: return "ESI version mismatch !";
    case 0x7796: return "Temperature sensor failure  !";
    case 0x7797: return "Pulse train frequency too high !";
    case 0x7798: return "Motor runaway condition detected  !";

    case 0x7799: return "Regen resistor overload !";
    case 0x7800: return "SAVE and power cycle required !";
    case 0x7801: return "Motor plate read failed  !";
    case 0x8130: return "CAN heartbeat lost !";
    case 0x8180: return "Drive locked  !";
    case 0x8380: return "Unstable current loop  !";
    case 0x8481: return "Velocity over-speed exceeded  !";
    case 0x8482: return "Exceeded maximum velocity error !";
    case 0x8608: return "Secondary feedback position mismatch !";
    case 0x8609: return "PE reached software numerical limit !";
    case 0x8611: return "Exceeded maximum position error J1 \
                -- Watchdog fault ≡ [3 bars] \
                Feedback type auto-detection failed. e129 \
                EnDat encoder in-turn resolution exceeds 32 bits. e130 \
                MOTORNAME and MTP data are not compatible. e131 \
                CAN is in bus-off state Fb7\
                Invalid gain table data n43\
                Logic AC power failure o6\
                Digital output over-current fault o9\
                Detected IQ current is greater than 120% of ILIM P3 !";
            default:
                return QString("其他异常保护,错误码:%1").arg( error_code );

    }
}

// 清能德创
QString EthercatError::dynatron_error(int error_code)
{
    switch( error_code )
    {

    case 0x2250: return "0x2250驱动器短路 !";
        case 0x2330: return "0x2330驱动器输出对地短路 !";
        case 0x2341: return "0x2341驱动器UV短路 !";
        case 0x2342: return "0x2342驱动器VW短路 !";
        case 0x2343: return "0x2343驱动器WU短路 !";
        case 0x5210: return "0x5210AD采样电路异常 !";
    case 0x5530: return "0x5530EEPROM异常 !";
    case 0x6310: return "0x6310参数未初始化 !";
    case 0xFF04: return "0xFF04编码器数据异常 !";
    case 0xFF07: return "0xFF07转子定位错误 !";
    case 0xFF0A: return "0xFF0A充电继电器异常 !";
    case 0x7111: return "0x7111能耗制动接线错误 !";
    case 0xFF11: return "0xFF11 AD校正系数异常 !";
    case 0xFF12: return "0xFF12 可编程器件固件匹配错误 !";
    case 0xFF13: return "0xFF13 控制板参数与功率板匹配错误 !";
    case 0xFF1A: return "0xFF1A 电机接线相序错误 !";
    case 0xFF2B: return "0xFF2B 编码器内部通信异常 !";
    case 0xFF00: return "0xFF00 系统初始化失败 !";
    case 0xFF05: return "0xFF05 编码器内部故障 !";
    case 0xFF06: return "0xFF06 编码器类型变更 !";
    case 0xFF88: return "0xFF88 EtherCAT PDO配置错误 !";
    case 0xFF86: return "FF86 驱动器抱闸电路异常 !";
    case 0x2310: return "0x2310 驱动器过流U !";
    case 0x2311: return "0x2311 驱动器过流V !";
    case 0x2312: return "0x2312 驱动器过流W !";
    case 0x3210: return "0x3210 直流母线过压 !";
    case 0x5112: return "0x5112 24V控制电源欠压 !";
        case 0x6010: return "0x6010 看门狗溢出 !";
        case 0xFF02: return "0xFF02 驱动器持续过载 !";
        case 0xFF03: return "0xFF03 编码器接线错误 !";
        case 0xFF29: return "0xFF29 CPU过载 !";
        case 0xFF15: return "0xFF15 驱动器输出缺相  !";
    case 0xFF80: return "0xFF80 编码器操作异常故障 !";
    case 0xFF25: return "0xFF25 驱动器瞬时过载 !";
    case 0xFF2C: return "0xFF2C 编码器外部通信发送异常 !";
    case 0xFF2F: return "0xFF2F 编码器外部通信接收异常 !";
    case 0x2320: return "0x2320 驱动器硬件过流 !";
    case 0xFF89: return "0xFF89 驱动器旋变电路异常 !";
    case 0xFF8A: return "0xFF8A 控制模式设定错误 !";
    case 0x3130: return "0x3130 输入缺相故障 !";
    case 0x3220: return "0x3220 直流母线欠压 !";
    case 0x4210: return "0x4210 逆变功率模块过热!";
    case 0x4220: return "0x4220 逆变功率模块过冷 !";
    case 0x7112: return "0x7112 能耗制动过载 !";
    case 0x8311: return "0x8311 电机持续过载 !";
    case 0xFF19: return "0xFF19 能耗制动电阻过热 !";
    case 0xFF1C: return "0xFF1C 整流功率模块过热 !";
    case 0xFF20: return "0xFF20 电机U相瞬时过载 !";
    case 0xFF21: return "0xFF21 电机V相瞬时过载 !";
    case 0xFF22: return "0xFF22 电机W相瞬时过载 !";
    case 0xFF1D: return "0xFF1D 硬件STO1触发 !";
    case 0xFF27: return "0xFF27 硬件STO2触发 !";
        case 0xFF81: return "0xFF81 驱动器外部故障 !";
        case 0xFF08: return "0xFF08 STO配线异常 !";
        case 0x6320: return "0x6320 参数数据异常 !";
        case 0x8800: return "0x8800 位置控制溢出 !";
        case 0xFF18: return "0xFF18 速度跟随误差过大 !";
    case 0xFF1B: return "0xFF1B 控制周期参数设置错误 !";
    case 0xFF0D: return "0xFF0D EtherCAT过程数据错误 !";
    case 0xFF1E: return "0xFF1E 写EEPROM失败 !";
    case 0xFF0F: return "0xFF0F 寻原点失败 !";
    case 0xFF0E: return "0xFF0E EtherCAT总线指令非法 !";
    case 0xFF10: return "0xFF10 DriveStarter通讯异常 !";
    case 0xFF0C: return "0xFF0C EtherCAT总线通讯异常 !";
    case 0x8612: return "0x8612 位置硬超限 !";
    case 0xFF16: return "0xFF16 正向软限位 !";
    case 0xFF17: return "0xFF17 负向软限位 !";
    case 0xFF23: return "0xFF23 上电位置偏差过大 !";
    case 0xFF26: return "0xFF26 非法更改伺服参数 !";
    case 0xFF2A: return "0xFF2A 编码器电池欠电压故障 !";//多摩川编码器需要执行多圈清零命令。
    case 0xFF0B: return "0xFF0B 电机超速 !";
    case 0xFF2D: return "0xFF2D 电压限幅位置跟随误差过大 !";
    case 0xFF2E: return "0xFF2E 编码器超速故障 !";
    case 0xFF85: return "0xFF85 位置规划运行错误 !";
    case 0xFF87: return "0xFF87 多轴同步异常 !";
    case 0xFF84: return "0xFF84 EtherCAT总线同步异常  !";
    case 0xFF30: return "0xFF30 EEPROM版本变更 !";
    case 0xFF31: return "0xFF31 电机过载告警 !";
        case 0xFF32: return "0xFF32 能耗制动过载告警 !";
        case 0xFF33: return "0xFF33 欠压转速限制告警 !";
        case 0xFF34: return "0xFF34 直流母线欠压告警 !";
        case 0xFF35: return "0xFF35 历史故障记录异常告警 !";
        case 0xFF36: return "0xFF36 不支持设定控制模式 !";
    case 0xFF37: return "0xFF37 更改了重上电有效参数 !";
    case 0xFF38: return "0xFF38 CPU过载告警 !";
    case 0xFF39: return "0xFF39 编码器电池欠电压告警 !";//多摩川编码器需要执行多圈清零命令。？
    case 0xFF3A: return "0xFF3A 驱动器内部告警 !";
    case 0xFF3B: return "0xFF3B 机械原定未标定 !";
    case 0xFF3C: return "0xFF3C 驱动器未准备好 !";
    case 0xFF3D: return "0xFF3D 编码器外部通信接收告警 !";
    case 0xFF3E: return "0xFF3E 编码器外部通信发送告警 !";
    case 0xFF3F: return "0xFF3F 编码器内部通信告警 !";
    case 0xFF40: return "0xFF40 软限位告警 !";
    case 0xFF41: return "0xFF41 AD校正系数无效告警 !";
    case 0xFF42: return "0xFF42 位置规划参数异常告警 !";
    case 0xFF43: return "0xFF43 上电位置偏差过大告警 !";
    case 0x8611: return "0x8611 位置跟随误差过大 !";
            default:
                return QString("其他异常保护,错误码:%1").arg( error_code );

    }
}



// 汇川
QString EthercatError::inovance_error(int error_code)
{

    switch( error_code )
    {

        case 0x101: return "参数异常NO.1";
        case 0x102: return "可编程逻辑配置故障NO.1 !";
        case 0x103: return "FPGA 软件版本过低NO.1 !";
        case 0x104: return "可编程逻辑中断故障NO.1";
        case 0x105: return " 内部程序异常NO.1 !";
        case 0x108: return " 参数存储故障NO.1 !";
        case 0x111: return "  2000h/2001h 组参数出现异常NO.1!";
        case 0x120: return "产品匹配故障NO.1 !";
        case 0x121: return "伺服ON 指令无效故障NO.2 !";
        case 0x122: return "绝对位置模式产品匹配故障NO.1 !";
        case 0x130: return "DI 功能重复分配NO.1 !";
        case 0x131: return " DO 分配超限NO.1!";
        case 0x136: return " 电机ROM 中数据校验错误或未存入参数NO.1!";
        case 0x200: return " 过流1 NO.1!";
        case 0x201: return "过流2 NO.1 !";
        case 0x207: return " D/Q 轴电流溢出故障NO.1!";
        case 0x208: return " FPGA 系统采样运算超时NO.1!";
        case 0x210: return " 输出对地短路NO.1!";
        case 0x220: return " UVW 相序错误NO.1!";
        case 0x234: return " 飞车NO.1 !";
        case 0x400: return "主回路电过压NO.1 !";
        case 0x410: return " 主回路电欠压NO.1!";
        case 0x420: return " 主回路电缺相NO.2!";
        case 0x430: return " 控制电欠压NO.1!";
        case 0x500: return " 电机超速NO.1!";
        case 0x510: return " 脉冲输出过速NO.2!";
        case 0x602: return " 角度辨识失败NO.1!";
        case 0x610: return "驱动器过载NO.2 !";
        case 0x620: return "电机过载NO.2 !";
        case 0x630: return " 电机堵转NO.2!";
        case 0x650: return " 散热器过热NO.2!";
        case 0x731: return " 编码器电池失效NO.2!";
        case 0x733: return " 编码器多圈计数错误NO.2!";
        case 0x735: return " 编码器多圈计数溢出NO.2!";
        case 0x740: return " 编码器干扰NO.1!";
        case 0x770: return "外部编码器标尺故障NO.1 !";
        case 0xA33: return " 编码器数据异常NO.1!";
        case 0xA34: return " 编码器回送校验异常NO.1!";
        case 0xA35: return " Z 信号丢失NO.1!";
        case 0xB00: return " 位置偏差过大NO.2!";
        case 0xB01: return " 电机命令速度到过最大允许速度!";
        case 0xB02: return " 全闭环位置偏差过大NO.2!";
        case 0xB03: return " 电子齿轮比设定超限NO.2!";
        case 0xB04: return " 全闭环使用错误NO.2!";
        case 0xD09: return "软件位置上下限设置错误* NO.2 !";
        case 0xD10: return "原点偏置设置错误* NO.2 !";
        case 0xE08: return "同步丢失* NO.2 !";
        case 0xE12: return " 网络初始化失败* NO.2!";
        case 0xE13: return "同步周期设定错误* NO.2 !";
        case 0xE15: return "同步周期误差过大* NO.2 !";
        case 0x110: return "分频脉冲输出设定故障NO.3 !";
        case 0x601: return " 回原点超时故障NO.3!";
        case 0x730: return "编码器电池警告NO.3 !";
        case 0x900: return "DI 紧急刹车NO.3 !";
        case 0x909: return "电机过载警告NO.3 !";
        case 0x920: return "制动电阻过载NO.3 !";
        case 0x922: return "外接制动电阻过小NO.3 !";
        case 0x939: return "电机动力线断线NO.3 !";
        case 0x941: return "变更参数需重新上电生效NO.3 !";
        case 0x942: return "参数存储频繁NO.3 !";
        case 0x950: return "正向超程警告NO.3 !";
        case 0x952: return "反向超程警告NO.3 !";
        case 0x980: return "编码器内部故障NO.3 !";
        case 0x990: return " 输入缺相警告NO.3!";
        case 0x998: return " 回零模式设置错误NO.3!";
        case 0xA40: return " 参数辨识失败NO.3!";

    case 0x6320: return "变更参数需重新上电生效NO.3|外接制动电阻过小NO.3 |全闭环使用错误NO.2|电子齿轮比设定超限NO.2|分频脉冲输出设定故障NO.3|原点偏置设置错误* NO.2 |DO 分配超限NO.1|DI 功能重复分配NO.1|参数异常NO.1|内部程序异常NO.1|2000h/2001h 组参数出现异常NO.1 ";
    case 0x7500: return "可编程逻辑配置故障NO.1|FPGA 软件版本过低NO.1 |可编程逻辑中断故障NO.1!";
    case 0x5530: return " 参数存储故障NO.1 !";
    case 0x7122: return "产品匹配故障NO.1 |绝对位置模式产品匹配故障NO.1!";
    case 0x5441: return "伺服ON 指令无效故障NO.2 !";
    case 0x2311: return " 过流1 NO.1!";
    case 0x2312: return "过流2 NO.1 !";
    case 0x0fff: return " 参数辨识失败NO.3|回零模式设置错误NO.3|回原点超时故障NO.3| 同步丢失* NO.2|角度辨识失败NO.1|脉冲输出过速NO.2|飞车NO.1|UVW 相序错误NO.1|FPGA 系统采样运算超时NO.1|D/Q 轴电流溢出故障NO.1!";
    case 0x2330: return " 输出对地短路NO.1!";
    case 0x3210: return "制动电阻过载NO.3|主回路电过压NO.1 !";
    case 0x3220: return " 主回路电欠压NO.1!";
    case 0x3130: return " 输入缺相警告NO.3|主回路电缺相NO.2!";
    case 0x3120: return " 控制电欠压NO.1!";
    case 0x8400: return " 电机超速NO.1!";
    case 0x3230: return "电机过载警告NO.3|电机过载NO.2|驱动器过载NO.2 !";
    case 0x7121: return " 电机堵转NO.2!";
    case 0x4210: return " 散热器过热NO.2!";
    case 0x7305: return " 编码器内部故障NO.3 |编码器电池警告NO.3|电机ROM 中数据校验错误或未存入参数NO.1|Z 信号丢失NO.1|编码器回送校验异常NO.1|编码器数据异常NO.1外部编码器标尺故障NO.1 |编码器干扰NO.1!|编码器多圈计数溢出NO.2|编码器多圈计数错误NO.2|编码器电池失效NO.2!";
    case 0x8611: return " 全闭环位置偏差过大NO.2|位置偏差过大NO.2!";
    case 0x5442: return "DI 紧急刹车NO.3 !";
    case 0x3331: return "电机动力线断线NO.3 !";
    case 0x7600: return "参数存储频繁NO.3 !";
    case 0x5443: return "正向超程警告NO.3 !";
    case 0x5444: return "反向超程警告NO.3 !";

        //203f-0 32bit 详细错误类型。
        //0x400740 编码器断线 603f＝0x7305
        //0x300730? 编码器电池警告 603f＝0x7305
        //0x310731 编码器电池失效 603f＝0x7305


            default:
                return QString("其他异常保护,0x603f错误码:%1,详细错误码查看0x203f对象").arg( error_code );

    }
}

// BURKMORE
QString EthercatError::burkmore_step_motor_error(int error_code)
{
    switch( error_code )
    {

    case 0x2320: return "输出过流 !";
    case 0x2310: return "连续过流 !";
    case 0x7580: return "Powerlink 通讯故障 !";
    case 0x7581: return " EtherCAT 通讯故障!";
    case 0x7590: return " PowerLink 板卡错误!";
    case 0x7591: return "EtherCAT 板卡错误 !";
    case 0x8480: return "同向超速 !";
    case 0x8481: return "反向超速 !";
    case 0x8482: return "超过最大转速 !";
    case 0x8483: return " 速度跟踪误差过大!";
    case 0x8484: return " 加速度超差!";
    case 0x8485: return "电机失速 !";
    case 0x7380: return "编码器连接错误 !";
    case 0x7381: return "编码器电池欠压 !";
    case 0x7382: return "编码器电池断开 !";
    case 0x7383: return " 编码器过热!";
    case 0x7384: return " 编码器计数错误!";
    case 0x7385: return " 编码器超速!";
    case 0x7386: return "编码器内部故障 !";
    case 0x8611: return "位置偏差过大 !";
    case 0x3220: return "伺服欠压 !";
    case 0x3210: return "伺服过压 !";
    case 0x4310: return "伺服过温 !";
    case 0x2350: return "模块过载（I2T） !";
    case 0x5480: return " 伺服过载!";
    case 0x3380: return "编码器校零失败 !";
    case 0x3381: return " 输出缺相!";
    case 0x3130: return "输入缺相 !";
    case 0x5441: return "内部连接错误 !";
    case 0x5280: return "内部错误1 !";
    case 0x5210: return "PowerID 错误 !";
    case 0x5281: return "内部错误2 !";
    case 0x7180: return " 电机过载（I2T）!";
    case 0x4210: return " 电机过温!";
    case 0x7181: return "电机抱闸故障 !";
    case 0x7182: return "制动电阻过载 !";

            default:
                return QString("其他异常保护,错误码:%1").arg( error_code );

    }

}

QString EthercatError::kinco_motor_error(int error_code)
{
    QString tmpErrorInfo;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+= "驱动器内部错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "编码器ＡＢＺ连接错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "编码器UVW连接错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器计数错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器高温错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器高压错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器低压错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器过流错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器吸收电阻错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "位置误差过大错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "逻辑低压错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机或驱动器iit错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "脉冲频率过高错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机高温错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机励磁错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "存储器错误 !";
    }


    return tmpErrorInfo;


}

QString EthercatError::motec_motor_error(int error_code)
{
    QString tmpErrorInfo;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+= "系统故障 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "启动故障 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "参数错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "欠压报警 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "过压报警 !";//5
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "I2T报警 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "超过峰值电流 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "位置误差超过限制 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "编码器故障 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "速度误差超过限制 !";//10
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "功率模块温度过高警告 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "功率模块温度过高错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "STO激活保护 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "FLASH故障 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电流偏差值故障 !";//15
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机没有使能 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "IPM故障 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "速度超过限制报警 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "缺相报警 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机温度过高报警 !";//20
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  " I2T警告!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "正向限位警告 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "负相限位警告 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "放电电阻过热 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  " 电机温度过高警告!";//25
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  " 编码器初始化故障!";
    }


    return tmpErrorInfo;
}

QString EthercatError::robotiq_motor_error(int error_code)
{
    QString tmpErrorInfo;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+= "过热 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "过电压 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "低电压!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "短路 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "急停 !";//5
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "编码器错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "MOSFET错误!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "开机后加载默认配置 !";
    }

    //电机错误
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+= "电机电流超限制 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机堵转(或编码器断线损坏) !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机Loop Error!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机安全停止激活 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机超越正限位 !";//5
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机超越负限位 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "amps设置点触发!";
    }



    return tmpErrorInfo;
}

QString EthercatError::amc_motor_error(int error_code)
{//故障次数记录在0x2028里面。
    QString tmpErrorInfo;
    //driver protection status
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动重置 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "内部错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "短路!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电流过冲!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "欠压 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "过压 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "驱动器温度过高 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "reserved!";
    }
    error_code=error_code>>1;
    //system protection status
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "参数重置错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+= "参数保存错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "无效hall状态 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "phase sync 错误!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机温度过高 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "phase 探测错误 !";//5
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "反馈编码器错误 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "电机过速度!";
    }
    error_code=error_code>>1;
//
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "超正限位 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+= "超负限位 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "通讯错误，节点保护 !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "pwm inpu broken wire!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "reserved !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "reserved !";//5
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "reserved !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "reserved!";
    }
    error_code=error_code>>1;
    //driver system status1
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "log entry missed !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "software disable !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "user disable!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "user positive inhibit!";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "user negative inhibit !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "current limiting !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "continuous current !";
    }
    error_code=error_code>>1;
    if( error_code&0x0001 == 0x0001)
    {
        tmpErrorInfo+=  "current loop satuated!";
    }


    return tmpErrorInfo;
}

QString EthercatError::xinsong2motor_error(int error_code)
{
    QString tmpErrorInfo;
    if( 1==error_code)
    {
        tmpErrorInfo+= "A电机短路 !";
    }
    else if( 2==error_code)
    {
        tmpErrorInfo+=  "B电机短路 !";
    }
    else if( 3==error_code)
    {
        tmpErrorInfo+=  "A电机过载 !";
    }
    else if( 4==error_code)
    {
        tmpErrorInfo+=  "B电机过载 !";
    }
    else if( 5==error_code)
    {
        tmpErrorInfo+=  "A电机失速 !";
    }
    else if( 6==error_code)
    {
        tmpErrorInfo+=  "B电机失速 !";
    }
    else if( 7==error_code)
    {
        tmpErrorInfo+=  "A电机限位保护 !";
    }
    else if( 8==error_code)
    {
        tmpErrorInfo+=  "B电机限位保护 !";
    }
    else if( 9==error_code)
    {
        tmpErrorInfo+=  "A电机角度调节反向 !";
    }
    else if( 10==error_code)
    {
        tmpErrorInfo+=  "B电机角度调节反向 !";
    }
    else if( 11==error_code)
    {
        tmpErrorInfo+=  "上位机通讯连接失败 !";
    }
    else if( 12==error_code)
    {
        tmpErrorInfo+=  "欠压保护 !";
    }
    else if( 13==error_code)
    {
        tmpErrorInfo+=  "过压保护 !";
    }
    else if( 14==error_code)
    {
        tmpErrorInfo+=  "驱动器保温保护 !";
    }
    else if( 15==error_code)
    {
        tmpErrorInfo+=  "A电机霍尔信号错误 !";
    }
    else if( 16==error_code)
    {
        tmpErrorInfo+=  "B电机霍尔信号错误 !";
    }
    else if( 17==error_code)
    {
        tmpErrorInfo+=  "内部反馈板连接超时 !";
    }
    else if( 18==error_code)
    {
        tmpErrorInfo+=  "前导航传感器连接超时 !";
    }
    else if( 19==error_code)
    {
        tmpErrorInfo+=  "后导航传感器连接超时 !";
    }
    else if( 20==error_code)
    {
        tmpErrorInfo+=  "RFID传感器连接超时 !";
    }
    else if( 21==error_code)
    {
        tmpErrorInfo+=  "障碍物传感器连接超时 !";
    }
    else
    {
        tmpErrorInfo+=  "未知驱动器错误 !"+QString::number(error_code);
    }


    return tmpErrorInfo;
}

QString EthercatError::curtius2motor_error(int error_code)
{
   QString tmpErrorInfo;

   unsigned char tmpLow=0xff&error_code;

   unsigned char tmpHigh=(0xff00&error_code)>>8;

   tmpErrorInfo="行走电机错误代码:";
   tmpErrorInfo+=QString::number(tmpLow);
   tmpErrorInfo+=",转向电机错误代码:";
   tmpErrorInfo+=QString::number(tmpHigh);
   return tmpErrorInfo;
}

QString EthercatError::taike_error(int error_code)
{

    switch( error_code )
    {

        case 0x2320: return "短路";
        case 0x4210: return "驱动器过温";
        case 0x3110: return "过压";
        case 0x3120: return "欠压";
        case 0x4300: return "电机过温";
        case 0x2280: return "反馈错误";
        case 0x7122: return "相位错误";
        case 0x2310: return "电流限制";
        case 0x3310: return "电压限制";
        case 0x7380: return "正限位";
        case 0x7381: return "负限位";
        case 0x7390: return "跟随超差";
        case 0x73a0: return "位置计数器到达";
        case 0x5080: return "故障，无其它紧急情况";
        case 0x8130: return "节点错误";
        case 0x61ff: return "命令错误(通讯断开保护)";


    default:
        return QString("其他异常,0x603f错误码:%1").arg( error_code );

    }
}
